from pathlib import Path
import json

number = input("输入一个喜欢的数：")
try:
    number = int(number)
    path = Path('10_chapter_10_test\\numbers.json')
    contents = json.dumps(number)
    path.write_text(contents)
    print("已存储你喜欢的数字。")
except:
    print("要输入数字！")